#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include "RBTree.h"
namespace sk
{
	template < class K>
	class MySet
	{
	public:
		struct SetKeyOfT
		{
			const K& operator()(const K& k)
			{
				return k;
			}
		};
		typedef typename RBTree<K, K, SetKeyOfT>::_iterator iterator;

		iterator begin()
		{
			return _t.begin();
		}

		iterator end()
		{
			return _t.end();
		}

		pair<iterator, bool> Insert(const K& key)
		{
			return _t.Insert(key);
		}
		iterator find(const K& key)
		{
			return _t.Find(key);
		}
	private:
		RBTree<K, K, SetKeyOfT> _t;
	};
	void SetTest()
	{
		MySet<string> s;
		s.Insert("1");
		s.Insert("2");
		s.Insert("3");
		s.Insert("4");
		s.Insert("5");
		MySet<string> s2(s);
		MySet<string> s3 = s2;

		MySet<string>::iterator it= s2.begin();
		cout << "set: " << endl;
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;

		for (auto& e : s3)
		{
			cout << e << " ";
		}
		cout << endl;
	}
}